home *** CD-ROM | disk | FTP | other *** search
- Program Windoing_Demo;
- Uses Crt;
- Type
- W_Window = Object
-
- { Variables }
- X,Y,X2,Y2 : Byte; { Cordinets of window }
- Title : String[80]; { Title String }
- FCol,BCol : Byte; { Window front and back colors }
- TFCol,TBCol : Byte; { Title front and back color }
-
- { Methods }
- Procedure Init(XX,YY,XX2,
- YY2:Byte;Tit:
- String); { Init the window }
- Procedure Draw; { Draws the window }
- Procedure SetWColors(F,B:
- Byte); { Set the window colors }
- Procedure SetTColors(F,B:
- Byte); { Set the title colors }
- End;
- Var
- W : W_Window;
- (****************************************************************************)
- Procedure W_Window.Init(XX,YY,XX2,YY2:Byte;Tit:String);
- Begin
- X:=XX;
- Y:=YY;
- X2:=XX2;
- Y2:=YY2;
- Title:=Tit;
- FCol:=7;
- BCol:=0;
- TFCol:=15;
- TBCol:=0;
- End;
- (****************************************************************************)
- Procedure W_Window.Draw;
- Var
- I : Integer;
- Begin
- TextColor(FCol);
- TextBackGround(BCol);
- GotoXY(X,Y);
- Write('╔');
- For I:=X+1 To X2-1 do Write('═');
- Write('╗');
- For I:=Y+1 To Y2-1 do Begin
- GotoXY(X2,I);
- Write('║');
- End;
- GotoXY(X2,Y2);
- Write('╝');
- For I:=X2-1 DownTo X+1 do Begin
- GotoXY(I,Y2);
- Write('═');
- End;
- GotoXY(X,Y2);
- Write('╚');
- For I:=Y2-1 DownTo Y+1 Do Begin
- GotoXY(X,I);
- Write('║');
- End;
- Window(X+1,Y+1,X2-1,Y2-1);
- ClrScr;
- TextColor(TFCol);
- TextBackGround(TBCol);
- Window(1,1,80,25);
- GotoXY(((X+X2)Div 2)-Length(Title)Div 2,Y);
- Write(Title);
- GotoXY(1,1);
- End;
- (****************************************************************************)
- Procedure W_Window.SetWColors(F,B : Byte);
- Begin
- FCol:=F;
- BCol:=B;
- End;
- (****************************************************************************)
- Procedure W_Window.SetTColors(F,B : Byte);
- Begin
- TFCol:=F;
- TBCol:=B;
- End;
- (****************************************************************************)
- Begin
- TextColor(7);
- TextBackGround(0);
- ClrScr;
- W.Init(20,6,60,12,'Window 1');
- W.Draw;
- TextColor(7);
- TextBackGround(0);
- Write('Press any key to change window colors');
- ReadKey;
- GotoXY(1,1);
- TextColor(7);
- TextBackGround(0);
- Write('Press any key to change title colors ');
- W.SetWColors(15,0);
- W.Draw;
- ReadKey;
- GotoXY(1,1);
- TextColor(7);
- TextBackGround(0);
- Write('Done! ');
- W.SetTColors(7,0);
- W.Draw;
- ReadKey;
- End.